////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008 Michiel Helvensteijn                                    //
//                                                                            //
// This file is part of the Mist compiler.                                    //
//                                                                            //
// The Mist compiler is free software: you can redistribute it and/or modif   //
// it under the terms of the GNU General Public License as published by       //
// the Free Software Foundation, either version 3 of the License, or          //
// (at your option) any later version.                                        //
//                                                                            //
// The Mist compiler is distributed in the hope that it will be useful,       //
// but WITHOUT ANY WARRANTY; without even the implied warranty of             //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              //
// GNU General Public License for more details.                               //
//                                                                            //
// You should have received a copy of the GNU General Public License          //
// along with the Mist compiler.  If not, see <http://www.gnu.org/licenses/>. //
////////////////////////////////////////////////////////////////////////////////

#ifndef PATH_HPP
#define PATH_HPP

/******************************************************************************
 * Includes                                                                   *
 ******************************************************************************/

#include <string>
using std::string;

#include <vector>
using std::vector;

#include <ostream>
using std::ostream;

#include <boost/range.hpp>

#include <boost/operators.hpp>
using boost::totally_ordered;
using boost::addable;

/******************************************************************************
 * Path Class                                                                 *
 ******************************************************************************/

class Path : public totally_ordered<Path>, public addable<Path, string> {
	public:
		
		typedef vector<string>::iterator       iterator;
		typedef vector<string>::const_iterator const_iterator;
	
	public:
		
		Path();
		
		Path(const string& onlyString);
		
		Path(const char* a1, ...);
		
		const string& operator[](unsigned int index) const;
		
		const string& head() const;
		
		Path tail() const;
		
		unsigned int depth() const;
		
		const Path& operator+=(const string& element);
		
		bool operator<(const Path& other) const;
		
		bool operator==(const Path& other) const;
		
		bool is_absolute() const;
		
		ostream& report_to_stream(ostream& out) const;
		
		iterator       begin();
		iterator       end();
		const_iterator begin() const;
		const_iterator end() const;
	
	private:
		
		vector<string> _path;
};

/******************************************************************************
 * Output Stream Operator                                                     *
 ******************************************************************************/

ostream& operator<<(ostream& stream, const Path& path);

#endif // PATH_HPP
